#include <stdio.h>
int pown(int a, int b)
{
    int t = 1;
    for (int i = 0; i < b; i++)
    {
        t *= a;
    }
    return t;
}
int main()
{
    int n, l, r, t, sum = 0;
    scanf("%d", &n);
    l = pown(10, n - 1);
    r = pown(10, n) - 1;
    for (int i = l; i <= r; i++)
    {
        t = i;
        sum = 0;
        while(t > 0)
        {
            sum += pown(t % 10, n);
            t /= 10;
        }
        if(sum == i)
        {
            printf("%d\n", i);
        }
    }
    return 0;
}